#!/bin/sh
case "$1" in
start)
  modprobe i2c-bcm2708 
  modprobe i2c-dev
  modprobe rtc-ds1374
  sudo sh -c "echo ds1374 0x68 > /sys/class/i2c-adapter/i2c-0/new_device"
  sudo picoLCD backlight 0
  cd /home/pi/regulator/regulatorogravanja/WebApplication8/
  sudo /usr/bin/python /home/pi/regulator/regulatorogravanja/WebApplication8/reg.py &
  sudo echo $! > /tmp/reg
;;
stop)
  if [ -f /tmp/reg ]; then
    kill -TERM `cat /tmp/reg`
    sudo rm -f /tmp/reg
  fi
;;
*)
  echo "Syntax: $0 <start|stop>"
esac
